/*
 * @Description: 品牌信息
 * @Author: iamsmiling
 * @Date: 2021-06-05 18:32:03
 * @LastEditTime: 2021-06-08 06:21:04
 */

import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/pages/publish_square/children/publish_center/dialog/show_brand_demo_dialog.dart';
import 'package:credit_business_circle/pages/publish_square/children/publish_center/dialog/show_title_demo_dialog.dart';
import 'package:credit_business_circle/pages/publish_square/children/publish_center/publish_center_controller.dart';
import 'package:credit_business_circle/pages/publish_square/children/publish_center/widget/text_field_label_tip.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';

class BrandFormCard extends StatelessWidget {
  final PublishCenterController controller;
  const BrandFormCard({Key? key, required this.controller}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.all(R.dimen.dp10),
      padding: EdgeInsets.symmetric(
          vertical: R.dimen.dp22, horizontal: R.dimen.dp10),
      decoration: BoxDecoration(
          color: R.color.ffffffff,
          borderRadius: BorderRadius.circular(R.dimen.sp5)),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          TextFieldLableTip(
            label: "品牌名称",
            showDemo: () => showBrandDemoDialog(context),
          ),
          Container(
            alignment: Alignment.center,
            padding: EdgeInsets.only(left: R.dimen.dp10),
            margin: EdgeInsets.only(top: R.dimen.dp16, bottom: R.dimen.dp28),
            decoration:
                BoxDecoration(border: Border.all(color: R.color.ffcccccc)),
            child: TextFormField(
              maxLines: 1,
              maxLengthEnforcement: MaxLengthEnforcement.enforced,
              textAlignVertical: TextAlignVertical.center,
              onFieldSubmitted: (String v) {
                if (v.length > 5) {
                  Get.snackbar("title", "", snackPosition: SnackPosition.TOP);
                }
              },
              decoration: InputDecoration(
                hintText: "展示在标题前，限5个字",
                hintStyle:
                    TextStyle(color: R.color.ff999999, fontSize: R.dimen.sp13),
              ),
            ),
          ),
          TextFieldLableTip(
            label: "信息标题",
            showDemo: () => showTitleDemoDialog(context),
          ),
          Container(
            alignment: Alignment.center,
            padding: EdgeInsets.only(left: R.dimen.dp10),
            margin: EdgeInsets.only(top: R.dimen.dp16),
            decoration:
                BoxDecoration(border: Border.all(color: R.color.ffcccccc)),
            child: TextFormField(
              maxLines: 3,
              maxLengthEnforcement: MaxLengthEnforcement.enforced,
              textAlignVertical: TextAlignVertical.center,
              onFieldSubmitted: (String v) {
                if (v.length > 5) {
                  Get.snackbar("title", "", snackPosition: SnackPosition.TOP);
                }
              },
              decoration: InputDecoration(
                hintText: "不要带特殊符号，不要重复品牌名称，限35个字",
                hintStyle:
                    TextStyle(color: R.color.ff999999, fontSize: R.dimen.sp13),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
